//? 发送ajax请求
import {ref} from "vue"
import axios from "axios";
export default function (url:string){
    const loading = ref(true);
    const data = ref(null);
    const errorMes = ref("");

    axios.get(url).then((value)=>{
        loading.value = false;
        data.value = value.data;

    }).catch((error)=>{
        loading.value = false;
        errorMes.value = error.message || '未知错误'
    })
    return {
        loading,
        data,
        errorMes
    }
}
